#if !defined(ximera_math_vector3_hpp)
#define ximera_math_vector3_hpp

// -----------------------------------------------------------

#include <ximera/types.hpp>
#include <ximera/math/util.hpp>

namespace ximera { namespace math
{
    class XIMERA_API Vector3
    {
    public:
        Real x, y, z;

    public:
        Vector3();
        Vector3(Real x, Real y, Real z);
        explicit Vector3(Real xyz);
        explicit Vector3(Real const xyz[3]);

        Real length() const;
        Real lengthSquared() const;

        Real dotProduct(Vector3 const& vec) const;
        Vector3 crossProduct(Vector3 const& vec) const;

        Vector3& normalize();
        Vector3 asNormal() const;

        Real& operator[](int i);
        Real const& operator[](int i) const;

        Real* array();
        Real const* array() const;

        Vector3 operator-() const;

        Vector3& operator+=(Vector3 const& rhs);
        Vector3& operator-=(Vector3 const& rhs);
        Vector3& operator*=(Real rhs);
        Vector3& operator/=(Real rhs);

        static Vector3 const ZERO;
        static Vector3 const E1;
        static Vector3 const E2;
        static Vector3 const E3;
    };

    // Vector3-Vector3 arithmetic
    Vector3 operator-(Vector3 const& lhs, Vector3 const& rhs);
    Vector3 operator+(Vector3 const& lhs, Vector3 const& rhs);
    Real operator*(Vector3 const& lhs, Vector3 const& rhs);

    // Vector3-Real arithmetic
    Vector3 operator*(Vector3 const& lhs, Real rhs);
    Vector3 operator*(Real lhs, Vector3 const& rhs);
    Vector3 operator/(Vector3 const& lhs, Real rhs);

    // Comparisons
    bool operator==(Vector3 const& lhs, Vector3 const& rhs);
    bool operator!=(Vector3 const& lhs, Vector3 const& rhs);
    bool operator<(Vector3 const& lhs, Vector3 const& rhs);
    bool operator>(Vector3 const& lhs, Vector3 const& rhs);
}}

#include <ximera/math/inline/vector3.inl>

// -----------------------------------------------------------

#endif
